﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using CCWin;

namespace 易保全
{
    public partial class InputBoxForm : CCSkinMain
    {
        public string RecordName = string.Empty;
        public string RecordRemark = string.Empty;
        public InputBoxForm(string title, string lblStr, int maxLength, string defaultVal)
        {
            InitializeComponent();
            this.Text = title;
            this.tbInput.Text = defaultVal;
            this.tbInput.MaxLength = maxLength;
        }

        private void btnOk_Click(object sender, EventArgs e)
        {
            this.RecordName = this.tbInput.Text.Trim();
            this.RecordRemark = this.textBox1.Text.Trim();
            if (this.RecordName.Length == 0)
            {
                new FrmMsg("系统提示", "请设置录像名称").ShowDialog();
                return;
            }
            if (this.RecordRemark.Length == 0 || this.RecordRemark == "请输入录像备注")
            {
                new FrmMsg("系统提示", "请设置录像备注信息").ShowDialog();
                return;
            }
            this.DialogResult = DialogResult.OK;
            this.Close();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.RecordName = this.tbInput.Text;
            this.DialogResult = DialogResult.Cancel;
            this.Close();
        }

        private void tbInput_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                btnOk_Click(null, null);
            }
        }

        private void textBox1_Enter(object sender, EventArgs e)
        {
            //清空提示文字
            if (this.textBox1.Text == "请输入录像备注")
                this.textBox1.Text = "";
        }
    }
}
